<template>
  <div>
    <button @click="jian()">-</button>  
    <ul>    
      <li v-for="item in arr" :key="item.id">{{ item.name }}</li>     
    </ul>      
    <input type="text" v-model="a">
    <input type="text" v-model="b">                 
    <input type="text" v-model="c">
  </div>     
</template>     
        
<script>      
import axios from 'axios'                 
export default {             
//   name:'',        
  data() {                
    return {          
       arr:[],         
       a:'',        
       b:'',   
       c:''      
    }       
  },    
  methods: {  
    jian(){  
       this.$store.dispatch('jian',1)     
    },  
    list(){      
       axios.get('https://liu.zzgoodqc.cn/teas')       
    .then(res=>{    
      // console.log(res.data)        
      this.arr =res.data.data    
    })    
    .catch(e=>{   
      console.log(e)   
    })
    },
    add(){  
       axios({  
        url:'https://liu.zzgoodqc.cn/teas',  
        method:'post',  
        data:{        
          name:this.a,    
          type:this.b,    
          price:this.c    
        }
       })
       .then(res=>{
         console.log(res.data)
       })
       .catch(e=>{
        console.log(e)
       })
    }
  },
  mounted() {     
    this.list()
  }, 
}
</script>
<style lang='less' scoped>

</style>